package com.team.mp.mapper.dao;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.team.mp.mapper.dto.DepartmentDto;
import com.team.mp.mapper.entity.Department;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 千锋郑州Java学科欢迎你
 * @program: Tproject
 * @description: 持久层 定义操作数据库的方法
 * @author: lx
 * @create: 2023-03-27 11:59:17
 */
public interface DepartmentDao extends BaseMapper<Department> {
//    @Select("select n.* from t_news_collect nc inner join t_news n on nc.nid=n.id where nc.uid=#{uid} order by nc.create_time desc")
//    @Select("select\n " +
//            "d1.depart_order,d1.depart_name,d1.depart_address,d1.depart_image,d1.depart_info,d1.depart_status,d2.doctor_name,d2.doctor_phone\n" +
//            "from t_department d1 left join t_doctor d2 on d1.head_id = d2.id ${ew.customSqlSegment}")
    @Select("SELECT\n" +
            " d1.depart_order,d1.depart_name,d2.doctor_name,d2.doctor_phone,d1.depart_address,d1.depart_image,d1.depart_info,d1.depart_status\n" +
            " FROM t_department d1 LEFT JOIN t_doctor d2 ON d1.head_id = d2.id ${ew.customSqlSegment}")
    Page<DepartmentDto> page(Page page, @Param("ew") Wrapper queryWrapper);

}
